package com.awesome.todo;

import java.util.ArrayList;

import android.app.AlertDialog;
import android.content.Context;
import android.graphics.drawable.Drawable;

import com.google.android.maps.ItemizedOverlay;
import com.google.android.maps.OverlayItem;

public class TaskItemizedOverlay extends ItemizedOverlay<OverlayItem> {

	private ArrayList<OverlayItem> markers = new ArrayList<OverlayItem>();
	private Context context;
	public Drawable defaultMarker;
	private ArrayList<Task> taskList; // use this to determine individual tasks

	public TaskItemizedOverlay(Drawable defaultMarker, Context context) {
		// constructor can pass in a list of tasks.
		super(boundCenterBottom(defaultMarker));
		this.defaultMarker = defaultMarker;
		this.context = context;
		populate();

	}

	public void addOverlay(OverlayItem overlay) {
		overlay.setMarker(boundCenter(defaultMarker));
		markers.add(overlay);
		populate();
	}

	@Override
	protected OverlayItem createItem(int i) {
		return markers.get(i);
	}

	@Override
	public int size() {
		return markers.size();
	}

	// @Override
	// protected boolean onTap(int index) {
	// Task thisTask = taskList.get(index); // get task corresponding to this
	// // pushpin
	//
	// // Create a dialog with basic task info and display it to the user.
	// AlertDialog.Builder dialog = new AlertDialog.Builder(context);
	// dialog.setTitle(thisTask.getName());
	// dialog.setMessage(thisTask.getDescription());
	// dialog.show();
	//
	// return true;
	// }

}
